|
This article compares the Java and Android API and virtual machines. While most Android applications are written in Java-like language, there are many differences between the Java API and the Android API, and Android does not use a Java Virtual Machine but two other ones called either Dalvik or Android Runtime (ART). There is no Java Virtual Machine in the Android platform. Java bytecode is not executed. Instead Java classes are compiled into a proprietary bytecode format and run on Dalvik, a specialized virtual machine (VM) designed specifically for Android. Unlike Java VMs, which are stack machines, the Dalvik VM is a register-based architecture. Dalvik has some specific characteristics that differentiate it from other standard VMs: * The VM was designed to use less space. * The constant pool has been modified to use only 32-bit indexes to simplify the interpreter. * Standard Java bytecode executes 8-bit stack instructions. Local variables must be copied to or from the operand stack by separate instructions. Dalvik instead uses its own 16-bit instruction set that works directly on local variables. The local variable is commonly picked by a 4-bit 'virtual register' field. Because the bytecode loaded by the Dalvik virtual machine is not Java bytecode and due to the specific way Dalvik loads classes, it is not possible to load libraries packages as jar files. A different procedure must be used to load Android libraries, in which the content of the underlying dex file must be copied in the application private internal storage area before it is loaded. ==System properties== As is the case for the Java SE class , the Android class allows the retrieval of system properties. However, some mandatory properties defined with the Java Virtual Machine have no meaning or a different meaning on Android. For example: * "java.version" property returns 0 because it is not used on Android, * "java.specification.version" invariably returns 0.9 independently of the version of Android used, * "java.class.version" invariably returns 50 independently of the version of Android used, * "user.dir" has a different meaning on Android, * "user.home" and "user.name" properties do not exist on Android 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Comparison of Java and Android API」の詳細全文を読む スポンサード リンク
|